//
//  FactorySliderViewController.m
//  ShoppingExperience
//
//  Created by LiYinDi on 15-1-26.
//  Copyright (c) 2015年 RuiBen. All rights reserved.
//

#import "FactorySliderViewController.h"

@interface FactorySliderViewController ()

@end

@implementation FactorySliderViewController
-(void)viewWillAppear:(BOOL)animated
{
    
   
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self.slideSwitchView setLineWidth:900];
    [self.slideSwitchView setLineX:24];
    
    self.slideSwitchView.tabItemNormalColor = [QCSlideSwitchView colorFromHexRGB:@"333333"];
    self.slideSwitchView.tabItemSelectedColor = [QCSlideSwitchView colorFromHexRGB:@"ff6600"];
    self.slideSwitchView.shadowImage = [[UIImage imageNamed:@"dongtaixian_.png"]
                                        stretchableImageWithLeftCapWidth:59.0f topCapHeight:0.0f];
    
    [self.slideSwitchView setKFontSizeOfTabButton:20.0f];
    [self.slideSwitchView setKWidthOfButtonMargin:150.0f];
    
    [self.slideSwitchView setLineWidth:900];
    [self.slideSwitchView setLineX:24];
    
    self.slideSwitchView.tabItemNormalColor = [QCSlideSwitchView colorFromHexRGB:@"333333"];
    self.slideSwitchView.tabItemSelectedColor = [QCSlideSwitchView colorFromHexRGB:@"ff6600"];
    self.slideSwitchView.shadowImage = [[UIImage imageNamed:@"dongtaixian_.png"]
                                        stretchableImageWithLeftCapWidth:59.0f topCapHeight:0.0f];
    
    [self.slideSwitchView setKFontSizeOfTabButton:20.0f];
    [self.slideSwitchView setKWidthOfButtonMargin:150.0f];
    
//    self.dynamicVC = [[FactoryDynamicViewController alloc] init];
//    self.dynamicVC.delegate=self;
//    self.dynamicVC.title = @"资讯";
//    
//    self.activityVC = [[FactoryActivityViewController alloc] init];
//    self.activityVC.delegate=self;
//    self.activityVC.title = @"活动";
    
    //    self.interactionVC=[[FactoryInteractionViewController alloc] init];
    //    self.interactionVC.title=@"互动";
    //
    self.productVC = [[FactoryNewProductViewController alloc] init];
    self.productVC.delegate=self;
    self.productVC.title = @"平台商品";
    
//    self.trainVC = [[FactoryTrainViewController alloc] init];
//    self.trainVC.delegate=self;
//    self.trainVC.title = @"培训";
    
    
    
    [self.slideSwitchView buildUI];


}
-(void)newProductRightTableView:(NSUInteger)index code:(NSString *)itemCode  companyCodeStr:(NSString *)companyCodeStr _itemCodeArray:(NSMutableArray *)_itemCodeArray _itemNameArray:(NSMutableArray *)_itemNameArray _itemWhereArray:(NSMutableArray *)_itemWhereArray _itemPriceArray:(NSMutableArray *)_itemPriceArray _itemUrlArray:(NSMutableArray *)_itemUrlArray _itemWeightArray:(NSMutableArray *)_itemWeightArray   _itemSeriesNameArray:(NSMutableArray *)_itemSeriesNameArray _itemTypeNameArray:(NSMutableArray *)_itemTypeNameArray _itemInDateArray:(NSMutableArray *)_itemInDateArray
{
  //  NSLog(@"fffffffff");
    if ([self.delegate respondsToSelector:@selector(factoryNewProductRightTableView:code: companyCodeStr:  _itemCodeArray:_itemNameArray:_itemWhereArray:_itemPriceArray:_itemUrlArray:_itemWeightArray:_itemSeriesNameArray:_itemTypeNameArray:_itemInDateArray:)]) {
        
        [self.delegate factoryNewProductRightTableView:index code:itemCode companyCodeStr:companyCodeStr _itemCodeArray:_itemCodeArray _itemNameArray:_itemNameArray _itemWhereArray:_itemWhereArray _itemPriceArray:_itemPriceArray _itemUrlArray:_itemUrlArray _itemWeightArray:_itemWeightArray _itemSeriesNameArray:_itemSeriesNameArray _itemTypeNameArray:_itemTypeNameArray _itemInDateArray:_itemInDateArray];
        
    }
}


- (NSUInteger)numberOfTab:(QCSlideSwitchView *)view
{
    // you can set the best you can do it ;
    return 1;
}

- (UIViewController *)slideSwitchView:(QCSlideSwitchView *)view viewOfTab:(NSUInteger)number
{
    return self.productVC;
//    if (number == 0) {
//        return self.dynamicVC;
//    }
//    else if (number == 1) {
//        return self.activityVC;
//    }
////    else if(number==2)
////    {
////        return self.interactionVC;
////    }
//    else if (number == 2) {
//        return self.productVC;
//        
//    }
//    else if (number == 3) {
//        return self.trainVC;
//    }
//    else {
//        return nil;
//    }
}
- (void)slideSwitchView:(QCSlideSwitchView *)view didselectTab:(NSUInteger)number
{
//    FactoryDynamicViewController *vc1 = nil;
//    FactoryActivityViewController *vc2=nil;
   FactoryNewProductViewController  *vc4=nil;
   //  FactoryTrainViewController *vc3=nil;

    if (number == 0) {
        vc4 = self.productVC;
       // vc1 = self.dynamicVC;
        //  [vc viewDidCurrentView];
    }
//    else if (number == 1) {
//        vc2 = self.activityVC;
//    }
//    else if (number==2)
//    {
//        vc3=self.trainVC;
//    }
//    else if (number == 3) {
//        vc4 = self.productVC;
//        //  [vc viewDidCurrentView];
//    }
   // else if (number==)
    //    [vc1 view];
}
#pragma mark FactoryDynamicDelegate Method
-(void)factoryDynamicCellClick:(NSString *)codeStr
{
    if ([self.delegate respondsToSelector:@selector(factoryDynamicCellSelected:)]) {
        
        [self.delegate factoryDynamicCellSelected:codeStr];
    }
    
}
#pragma mark FactoryActivityDelegate Method
-(void)factoryActivityCellClick:(NSString *)codeStr
{
    if ([self.delegate respondsToSelector:@selector(factoryActivityCellSelected:)]) {
        
        [self.delegate factoryActivityCellSelected:codeStr];
    }
}
#pragma mark FactoryTrainDelegate Method
-(void)videoBtnClick:(NSUInteger)index
{
    if ([self.delegate respondsToSelector:@selector(videoBtnSelected:)]) {
        
        [self.delegate videoBtnSelected:index];
    }
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
